<template>
    <div>
      <div>
        <header>
          <el-row type="flex" class="row-bg" justify="space-between">
            <router-link to="/user">
              <el-col :span="6">
                <div class="grid-content bg-purple">
                  <span class="iconfont">&#xe609;</span>
                </div>
              </el-col>
            </router-link>
            <div style="margin-right: 40.3%;color: #fff; font-size: 20px;">我参与的</div>
          </el-row>
        </header>
        <div style="height: 40.8px"></div>
      </div>
      <el-row>
      <el-col :xs="12" :sm="6" :md="4" :lg="3" :xl="6" v-for="item in joinedlist" :key="item.id">
        <el-card :body-style="{ padding: '5px'}" class="el-card">
          <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image" />
          <div class="div-content">
            <span>{{item.activityName}}</span>
            <div class="bottom clearfix">
              <time class="time">{{item.currentDate}}</time> 
              <time class="num">{{item.tookNumber+'/'+item.limitNumber}}</time>
            </div>
          </div>
          <div style="display: flex;flex-direction: row-reverse;">
            <el-button class="button" size="medium" type="primary">查看</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    name: 'JoinedList',
    props: {
      userId: String
    },
    data() {
      return {
        joinedlist: []
      }
    },
    methods: {
      getHomeInfo () {
          axios.get('/static/mock/joinedlist.json')
              .then(this.getHomeInfoSucc)
      },
      getHomeInfoSucc (res) {
          res = res.data
          if (res.ret && res.data) {
              const data = res.data
              this.joinedlist = data.joinedlist
          }else {
              alert('数据获取失败')
          }
          console.log(res)
      }
    },
    mounted () {
        this.getHomeInfo()
    }
}
</script>

<style scoped>
  header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    line-height: 2.5rem;
    background: #67C23A;
    text-align: center;
  }
  .iconfont {
    font-size: 1.6rem;
    color: #fff;
    margin-left: .4rem;
  }
    .time {
    font-size: 13px;
    color: #999;
  }
  .num {
  float: right;
  font-size: 13px;
  color: #999;
  width: 36.1px;
  text-align: center;
  }
  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }
  .button {
    margin-top: 4px;
    width: 100px;
  }
  .image {
    width: 100%;
    display: block;
  }
  .clearfix:before,
  .clearfix:after {
      display: table;
      content: "";
  }
  .div-content {
    padding: 12px 12px 0 12px;
  }
  .el-card {
    height: 300px;
  }
</style>